
{php}
	include ("editorhtml_js.html");
	include ("conf/configuration.php");
{/php}	

<link rel="stylesheet" type="text/css" href="css/datepicker.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/validations.css" />

<script type="text/javascript" src="js/jquery/jquery.js"></script>
<script type="text/javascript" src="js/jquery/jquery.meio.mask.js" charset="utf-8" ></script>
<script type="text/javascript" src="js/jquery/jquery.validate.js" charset="utf-8" ></script>
<script type="text/javascript" src="js/form/validations.js" charset="utf-8" ></script>
<script type="text/javascript" src="js/jquery.datePicker.js"></script>
<script type="text/javascript" src="js/date.js"></script>


{literal}
	<script type="text/javascript">
	    $(function(){
			$('.date-pick').datePicker();
	    });

	    $(function(){
			var btnUpload=$('#upload');
			var status=$('#status');
			new AjaxUpload(btnUpload, {
				action: 'upload-file.php',
				name: 'uploadfile',
				data: {action: 'add'},
				onSubmit: function(file, ext){
					 if (! (ext && /^(jpg|png)$/.test(ext))){ 
	                    // extension is not allowed 
						status.text('Only JPG, PNG or GIF files are allowed');
						return false;
					}
					status.text('Uploading...');
				},
				onComplete: function(file, response){
					//On completion clear the status
					status.text('');
					//Add uploaded file to list
					if(response!="error"){
						$('#files').html('<img class="fondoyborde" width="125px" src="'+response+'" />').addClass('success');
					} else{
						$('#files').html('<img class="fondoyborde" width="125px" src="images/licencias/nophoto.png" />').addClass('error');
					}
				}
			});
		});

	    $().ready(function() {
		});
		
	</script>
{/literal}



<div class="grid_10">
	<div class="box round first fullpage">
   		<h2>Formulario de Datos</h2>  
       	<div class="block ">
			<form id="formNoticia" method="post" action="noticias.php">
				<input type="hidden" id="action" name="action" value="save"/>
				<input type="hidden" id="id" name="id" value="{$noticia.id}" />
				<div class="subtitulo">Datos de la noticia</div><br>
				<table class="form">
					<tr>
						<td><label>Fecha:</label></td>
						<td>
							<input type="text" id="fecha" name="fecha" class="date-pick" value="{$noticia.fecha|date_format:"%d-%m-%Y"}" alt="alphanumeric" class="required" readonly title="El campo Fecha es requerido" />
						</td>
					</tr>
					<tr style="height:24px">
						<td><label>T&iacute;tulo:</label></td>
						<td>
							<input type="text" id="titulo" name="titulo" class="required"  size="120" title="El campo T&iacute;tulo es requerido" value="{$noticia.titulo}"/>
						</td>
					</tr>
					<tr style="height:24px">
						<td><label>Orden:</label></td>
						<td>
							<select name="orden">
								<option {if $noticia.orden==99}selected{/if} value="99">Sin prioridad</option>
								<option {if $noticia.orden==1}selected{/if} value="1">1</option>
								<option {if $noticia.orden==2}selected{/if} value="2">2</option>
								<option {if $noticia.orden==3}selected{/if} value="3">3</option>
								<option {if $noticia.orden==4}selected{/if} value="4">4</option>
								<option {if $noticia.orden==5}selected{/if} value="5">5</option>
								<option {if $noticia.orden==6}selected{/if} value="6">6</option>	
							</select>
						</td>
					</tr>
						<tr>
							<td><label>Categor&iacute;a</label></td>
							<td>
								<select name="categoria">
									<option value="">(seleccione)</option>
									{foreach from=$categoriasList item="categoria"}
										<option value="{$categoria.key}" {if $noticia.categoria == $categoria.key}selected{/if}>{$categoria.value}</option>
									{/foreach}								
								</select>
							</td>
						</tr>
					<tr style="height:24px">
						<td valign="top"><label>Resumen:</label></td>
						<td><textarea rows="5" cols="30" id="resumen" name="resumen" style="width: 744px">{$noticia.resumen}</textarea></td>
					</tr>
					<tr style="height:24px">
						<td valign="top"><label>Contenido:</label></td>
						<td ><textarea rows="5" cols="30" id="contenido" name="contenido" style="width: 744px">{$noticia.contenido}</textarea></td>
					</tr>				
					<tr>
						<td class="button" colspan="2"><br><br>
							<input type="submit" class="save btn btn-grey" value="Guardar cambios" />
							<input type="button" value="Cancelar" class="btn btn-grey" onclick="goToPage('noticias.php');" />
						</td>
					</tr>
				</table>
			</form>
			<br>
			<div style="margin-left:107px">
			{foreach from=$images item=image}
				<div class="imageDiv">
					<div style="text-align:center; height:150px;">
						<img width="150px" height="120px" style="border: 2px solid silver" src="images/contenido/small/{$image.filename}"/>
						{php}echo $baseurl;{/php}admin/images/contenido/{$image.filename}
					</div>
				</div>
			{/foreach}
			</div>
			<div style="clear:both"></div>
		</div>
	</div>
</div>
		
